package cn.lingyangwl.agile.infra.weixin.mp.assembly;

import cn.lingyangwl.agile.infra.weixin.mp.model.entity.MpAutoReply;
import cn.lingyangwl.agile.infra.weixin.mp.model.rqrs.MpAutoReplySaveReq;
import cn.lingyangwl.agile.infra.weixin.mp.model.rqrs.MpAutoReplyUpdateReq;
import cn.lingyangwl.agile.infra.weixin.mp.model.rqrs.MpMessageSendOutReq;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * 公众号消息自动回复
 *
 * @author shenguangyang
 */
@Mapper(componentModel = "spring")
public interface MpAutoReplyAssembly {

    MpAutoReply toAutoReply(MpAutoReplySaveReq source);

    MpAutoReply toAutoReply(MpAutoReplyUpdateReq source);

    @Mappings({
            @Mapping(source = "openId", target = "openId"),
            @Mapping(source = "reply.mpAppId", target = "appId"),
            @Mapping(source = "reply.responseMessageType", target = "type"),
            @Mapping(source = "reply.responseContent", target = "content"),
            @Mapping(source = "reply.responseMediaId", target = "mediaId"),
            @Mapping(source = "reply.responseTitle", target = "title"),
            @Mapping(source = "reply.responseDescription", target = "description"),
            @Mapping(source = "reply.responseArticles", target = "articles"),
    })
    MpMessageSendOutReq toMpMessageSendOutRQ(String openId, MpAutoReply reply);

}
